import empty from '@/views/components/empty_router.vue';
const req = require.context("./", true, /\.js$/)
let modules = []
req.keys().forEach((filename) => {
  let route = req(filename).default
  if (filename === "./index.js") return
  // 如果路由中有子路由，再添加空组件
  routeHandler(route)
  modules.push(route)
})

function routeHandler(route){
  if('children' in route){
    route.component = empty;
    for(var i in route.children){
      if('children' in route.children[i]){
        routeHandler(route.children[i])
      }
    }
  }
}

console.log(modules)
export default modules